package cn.qayy.listener;

import cn.qayy.service.IPlanService;
import cn.qayy.service.impl.PlanServiceImpl;
import com.alibaba.fastjson.JSONObject;

import java.util.*;


import javax.annotation.Resource;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class MyServletContextListener implements ServletContextListener{
   // @Resource(name = "planServiceImpl")
    private IPlanService planService = new PlanServiceImpl();

    @Override
    public void contextDestroyed(ServletContextEvent arg0) {

    }

    @Override
    public void contextInitialized(ServletContextEvent arg0) {
       /*
        List<String> typeaheadCondi = new ArrayList<String>();
        typeaheadCondi.add("commercial1");
        typeaheadCondi.add("terminal");
        typeaheadCondi.add("mgr");
        typeaheadCondi.add("terminalQs");
        typeaheadCondi.add("fenbu");
        typeaheadCondi.add("daibiao");
        typeaheadCondi.add("tichengbelong");
        typeaheadCondi.add("client");
        HashMap<String,String> condiMap = new HashMap<String,String>();
        for ( String condi : typeaheadCondi){
            List<String>  condiList= planService.selectGroup();
            String resultJson =  JSONObject.toJSONString(condiList);
            condiMap.put(condi,resultJson);
        }
        arg0.getServletContext().setAttribute("condiMap",condiMap);*/
    }
    /***
     * 在服务器启动的时候初始化ServletContext的时候，获取全国的协议
     */
    /*public static List<KdbNssLogClientPolicy> getAllPolicy(){
        return list;
    }*/
    public MyServletContextListener() {
        super();
    }

}
